package com.example.demo.vo

import com.example.demo.dbmodels.TTemperature
import io.swagger.annotations.ApiModelProperty


class TemperatureVo {

    @ApiModelProperty("id")
    var id: Int? = null

    @ApiModelProperty("病人id")
    var patientId: Int? = null

    @ApiModelProperty("病人姓名")
    var patientName: String? = null

    @ApiModelProperty("科室id")
    var deptId: Int? = null

    @ApiModelProperty("科室名称")
    var deptName: String? = null

    @ApiModelProperty("床位Id")
    var bedId: Int? = null

    @ApiModelProperty("床位名称")
    var bedName: String? = null

    @ApiModelProperty("测量日期")
    var date: String? = null

    @ApiModelProperty("体温值")
    var temperature: String? = null

//    fun getVo(queue: QueryRowSet): TemperatureVo {
//        queue.let {
//            val data = TemperatureVo()
//            data.id = it[TTemperatureDao.id]
//            data.bedId = it[TTemperatureDao.bedId]
//            data.bedName = it[TTemperatureDao.bedName]
//            data.date = it[TTemperatureDao.date]
//            data.deptId =  it[TTemperatureDao.deptId]
//            data.deptName =  it[TTemperatureDao.deptName]
//            data.patientId =  it[TTemperatureDao.patientId]
//            data.patientName =  it[TTemperatureDao.patientName]
//            data.temperature = it[TTemperatureDao.temperature]
//            return data
//        }
//    }

    fun getVo(table: TTemperature): TemperatureVo {
        table.let {
            val data = TemperatureVo()
            data.id = it.id
            data.bedId = it.bed_id
            data.bedName = it.bed_name
            data.date = it.date
            data.deptId = it.dept_id
            data.deptName = it.dept_name
            data.patientId = it.patient_id
            data.patientName = it.patient_name
            data.temperature = it.temperature
            return data
        }
    }

    fun getVoList(table: List<TTemperature>): List<TemperatureVo> {
        table.let {
            val dataList = mutableListOf<TemperatureVo>()
            it.forEach {
                val data = TemperatureVo()
                data.id = it.id
                data.bedId = it.bed_id
                data.bedName = it.bed_name
                data.date = it.date
                data.deptId = it.dept_id
                data.deptName = it.dept_name
                data.patientId = it.patient_id
                data.patientName = it.patient_name
                data.temperature = it.temperature
                dataList.add(data)
            }
            return dataList
        }
    }
}